package com.example.hw_3.Config;

import com.example.hw_3.common.UserResult;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
//全局异常
@RestControllerAdvice
public class AllException {

    @ExceptionHandler(Exception.class)
    public UserResult handleException(Exception e) {
        e.printStackTrace();
        return new UserResult(500, "全局异常", e.getMessage());
    }
}